************************************************************************************
/*
Policy Feedback as Political Weapon: 
Conservative Advocacy and the Demobilization of the Public Sector Labor Movement

Forthcoming in Perspectives on Politics

Alexander Hertel-Fernandez
Columbia University
School of International and Public Affairs
ah3467@columbia.edu

Replication code for analysis of individual worker participation

Originally run in Stata 15

*/
************************************************************************************

* Load trimmed ANES data

use "anesdata.dta", clear

* Descriptive statistics

sum mobilscale policyinplace contact_other govt age male white black hispanic educ faminc_ interestcamp strongpartisan if emp==1

sum mobilscale policyinplace contact_other govt age male white black hispanic educ faminc_ interestcamp strongpartisan if emp==1 & govt==0

sum mobilscale policyinplace contact_other govt age male white black hispanic educ faminc_ interestcamp strongpartisan if emp==1 & govt==1

table govt if emp==1, c(mean mobilscale)

* Define covariates

local covars unionmem c.age##c.age male white black hispanic i.educ faminc_ interestcamp strongpartisan 

* OLS regressions for private and public sector workers run separately

reg mobilscale policyinplace i.statefip i.year if emp==1 & govt==0, cluster(statefip)
reg mobilscale policyinplace `covars' i.statefip i.year if emp==1 & govt==0, cluster(statefip)

reg mobilscale policyinplace i.statefip i.year if emp==1 & govt==1, cluster(statefip)
reg mobilscale policyinplace `covars' i.statefip i.year if emp==1 & govt==1, cluster(statefip)

* NB regressions for private and public sector workers run separately

nbreg mobilscale policyinplace i.statefip i.year if emp==1 & govt==0, cluster(statefip)
nbreg mobilscale policyinplace `covars' i.statefip i.year if emp==1 & govt==0, cluster(statefip)

nbreg mobilscale policyinplace i.statefip i.year if emp==1 & govt==1, cluster(statefip)
nbreg mobilscale policyinplace `covars' i.statefip i.year if emp==1 & govt==1, cluster(statefip)

* Interactive OLS regressions

quietly: reg mobilscale policyinplace##govt i.statefip i.year if emp==1 [aw=weight], cluster(statefip)
estimates store main1
quietly: reg mobilscale policyinplace##govt `covars' i.statefip i.year if emp==1 [aw=weight], cluster(statefip)
estimates store main2

estout main1 main2 using appen_tab7.csv, cells(b(star fmt(2)) se(par fmt(2))) legend drop(_cons) stats(r2 N) starlevels(* 0.10 ** 0.05 *** 0.01) replace

/* Figure 3 in main text

quietly: reg mobilscale policyinplace##govt i.statefip i.year if emp==1 [aw=weight], cluster(statefip)
margins, dydx(policyinplace) over(gov) post
estimates store nocont

quietly: reg mobilscale policyinplace##govt unionmem `covars' i.statefip i.year if emp==1 [aw=weight], cluster(statefip)
margins, dydx(policyinplace) over(gov) post
estimates store cont

coefplot nocont cont, mcolor(black) ciopts(lcolor(black)) graphregion(color(white)) legend(off) xtitle("Change in Participation Index (0-5) from" "ALEC Model Bill Enactment") plotregion(lcolor(black)) ylabel(,glcolor(gs13)) xline(0,lcolor(black) lpattern(dash)) level(90)

*/

* Appendix regressions - exclude ND & TN

quietly: reg mobilscale policyinplace##govt i.statefip i.year if emp==1 & stateabb!="TN" & stateabb!="ND" [aw=weight], cluster(statefip)
quietly: estimates store inter1ndtn
quietly: reg mobilscale policyinplace##govt `covars' i.statefip i.year if emp==1 & stateabb!="TN" & stateabb!="ND" [aw=weight], cluster(statefip)
estimates store inter2ndtn

estout inter1ndtn inter2ndtn using appen_tab8.csv, cells(b(star fmt(2)) se(par fmt(2))) legend drop(_cons) stats(r2 N) starlevels(* 0.10 ** 0.05 *** 0.01) replace

* Appendix regressions - timing

quietly: reg mobilscale enacted_clock_1_2yrsbefore##gov enacted_clock_20##gov enacted_clock_1_2yrsafter##gov i.statefip i.year if emp==1 [aw=weight], cluster(statefip)
estimates store time1
quietly: reg mobilscale enacted_clock_1_2yrsbefore##gov enacted_clock_20##gov enacted_clock_1_2yrsafter##gov i.statefip i.year if emp==1 [aw=weight], cluster(statefip)
estimates store time2

estout time1 time2 using appen_tab9.csv, cells(b(star fmt(2)) se(par fmt(2))) legend drop(_cons) stats(r2 N) starlevels(* 0.10 ** 0.05 *** 0.01) replace

* Appendix regressions - union member interaction

quietly: reg mobilscale policyinplace##govt##unionmem i.statefip i.year if emp==1 [aw=weight], cluster(statefip)
estimates store unionint

estout unionint using appen_tab10.csv, cells(b(star fmt(2)) se(par fmt(2))) legend drop(_cons) stats(r2 N) starlevels(* 0.10 ** 0.05 *** 0.01) replace

* Appendix regressions - political interest

quietly: reg interestcamp policyinplace##govt i.statefip i.year if emp==1 [aw=weight], cluster(statefip)
estimates store polint

estout polint using appen_tab11.csv, cells(b(star fmt(2)) se(par fmt(2))) legend drop(_cons) stats(r2 N) starlevels(* 0.10 ** 0.05 *** 0.01) replace

* Appendix regressions - non-party GOTV contact

quietly: reg contact_other policyinplace##govt i.statefip i.year if emp==1 [aw=weight], cluster(statefip)
estimates store contactother1

estout contactother1  using appen_tab12.csv, cells(b(star fmt(2)) se(par fmt(2))) legend drop(_cons) stats(r2 N) starlevels(* 0.10 ** 0.05 *** 0.01) replace
